﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Web;

namespace SmartSpace.News.UI.Pages
{
    public partial class CreateAssetCategory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void _ctlBtnSave_Click(object sender, EventArgs e)
        {
            AssetService service = new AssetService();

            AssetCategory category = new AssetCategory();
            category.Id = Guid.NewGuid();
            category.Code = _ctlCode.Text;
            category.Name = _ctlName.Text;
            category.Description = _ctrlDesc.Text;
            category.Creator = Page.User.Identity.Name;
            category.CreateDate = DateTime.Now;

            service.SaveCategory(category);

            SsPage.Return(this, new { id = category.Code, name = category.Name });
        }
    }
}